#!/usr/bin/env python
# -*- coding: utf-8 -*-

#-*-
# UbiNote - A Lightweight Note-talking Application
#
# Copyright (C) 2006-2009 Shellex <5h3ll3x@gmail.com>
#
# UbiNote is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# UbiNote is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with UbiNote; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

class block:
    def __init__(s, raw):
        s.id = 0
        s.content = ""
        s.note_id = 0
        s.state = 0
        s.pos = 0
        if raw:
            s.format(raw)
            s.state = 1
        else:
            pass
            
    def format(s, raw):
        s.id, s.note_id, s.content, s.pos = raw

    def serialize(s):
        return {'id':s.id,'content': s.content, 'note_id': s.note_id, 'pos':s.pos}


